<template>
  <div class="nav-header">
    <el-icon :size="25" @click="handleFoldClick">
      <component :is="isFold ? 'Expand' : 'Fold'" class="fold-menu"></component>
    </el-icon>
    <div class="content">
      <user-info></user-info>
    </div>
  </div>
</template>

<script lang="ts" setup>
import { computed, defineComponent, ref } from 'vue'
import UserInfo from './user-info.vue'

const emit = defineEmits(['foldChange'])

const isFold = ref(false)
const handleFoldClick = () => {
  isFold.value = !isFold.value
  emit('foldChange', isFold.value)
}
</script>

<style scoped lang="scss">
.nav-header {
  display: flex;
  width: 100%;
  .fold-menu {
    cursor: pointer;
  }
}
.content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex: 1;
  padding: 0 20px;
}
</style>
